#include <bits/stdc++.h>

using namespace std;
int n;
const int N = 100010;
int num[N];

int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", &num[i]);
    }
    sort(num, num + n);
    long long ret = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i; j < n; ++j)
        {
            if (num[j] - num[i] == j - i)
            {
                ++ret;
            }
        }
    }
    cout << ret;
    return 0;
}
